//
//  aboutAPPViewController.m
//  easystudy
//
//  Created by 七 on 16/8/30.
//  Copyright © 2016年 kane. All rights reserved.
//

#import "aboutAPPViewController.h"



@interface aboutAPPViewController ()

@end



@implementation aboutAPPViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)bancBtn:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark UITableViewDelegate & datasource
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 190;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *background = [[UIView alloc] initWithFrame:(CGRect){0,0,self.view.frame.size.width,190}];
    UIImageView *image = [[UIImageView alloc] initWithFrame:(CGRect){0,0,self.view.frame.size.width,150}];
    image.image = [UIImage imageNamed:@"image_about"];
    UILabel *versionLab = [[UILabel alloc] initWithFrame:CGRectMake(0, image.frame.size.height, self.view.frame.size.width, 40)];
    versionLab.text = @"版本:1.0.0(Build 10000)";
    versionLab.textAlignment = NSTextAlignmentCenter;
    versionLab.textColor = [UIColor grayColor];
    versionLab.font = [UIFont systemFontOfSize:14];
    [background addSubview:versionLab];
    [background addSubview:image];
    return background;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *identify = [NSString stringWithFormat:@"%ld%ld",(long)indexPath.section,(long)indexPath.row];
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identify];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identify];
        [cell setAccessoryType:indexPath.section == 1?UITableViewCellAccessoryNone:UITableViewCellAccessoryDisclosureIndicator];
    }
    switch (indexPath.row) {
        case 0:
            cell.textLabel.text = @"小牙妹介绍";
            break;
            
        default:
            cell.textLabel.text = @"服务条款";
            break;
    }
    
    return cell;
}

-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    switch (indexPath.row) {
        case 0:{
            break;
        }
        case 1:{
            break;
        }
        default:
            break;
    }
}

@end
